
using System.Web.UI.HtmlControls;
using System;
using System.Configuration;
using System.Drawing;
using System.Data;
using System.Web.UI.WebControls;
using Microsoft.VisualBasic;
using System.Collections;
using System.Web.UI;
using System.Web;


using System.IO;
using System.Text;
//using com.ddsc.database;
using DDSC.OracleADO;
using com.ddsc.common;
using SMAS;
using System.Resources;
using System.Data.OracleClient;

//P3513S1029-解決建議售價(含稅)四捨五不入問題 Modify by JoeChou

//版本  修改日期  修改人員  修改案號    修　改　內　容
//－－  －－－－  －－－－  －－－－－  －－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－
//0001  20090224  JoeChou   P3109M0050  前後台新舊報價流程修改
//0002  2010022   EmilyLi   P3109M0325  建議售價、免稅商店售價、一般商店平均價售等價格及幣別欄位資料,
//                                      開放前台廠商可以修改。
//0003  201111109 WALTER    P3511M0122  報價呈案程式修改案
//                                        採購編號後狀態=3,呈案時皆要看到,所以STATUS>=3,都要顯示舊價格
//----------------------------------------------------------------------------------------------------------

namespace smasb2b
{
    public class VNDW0041 : BasePage
    {

        #region  Web Form ?]?p?u??????{???X

        //???? Web Form ?]?p?u??????I?s?C
        [System.Diagnostics.DebuggerStepThrough()]
        private void InitializeComponent()
        {

        }
        protected System.Web.UI.WebControls.Label lblENGLISH_SHORTNAME;
        protected System.Web.UI.WebControls.Label lblCHINESE_SHORTNAME;
        protected System.Web.UI.WebControls.Label lblCHINESE_FULLNAME;
        protected System.Web.UI.WebControls.Label lblENGLISH_FULLNAME;
        protected System.Web.UI.WebControls.Label lblSUPPLY_PRICE;
        protected System.Web.UI.HtmlControls.HtmlImage IMG1;
        protected System.Web.UI.WebControls.Label lblCODE1;
        protected ddscControlLibrary.InputBoxCtrl txtCODE;
        protected ddscControlLibrary.InputBoxCtrl txtENGLISH_SHORTNAME;
        protected ddscControlLibrary.InputBoxCtrl txtCHINESE_SHORTNAME;
        protected ddscControlLibrary.InputBoxCtrl txtCHINESE_FULLNAME;
        protected ddscControlLibrary.InputBoxCtrl txtENGLISH_FULLNAME;
        protected System.Web.UI.WebControls.Label lblMINNUM_QTY;
        protected ddscControlLibrary.InputBoxCtrl txtSUPPLY_PRICE;
        protected ddscControlLibrary.InputBoxCtrl txtCURRENCY_TYPE;
        protected ddscControlLibrary.SubmitButtonCtrl btnSave;
        protected ddscControlLibrary.SubmitButtonCtrl btnExit;
        protected ddscControlLibrary.InputBoxCtrl txtMINNUM_QTY;
        protected System.Web.UI.WebControls.Label lblSUPPLY_COEFFICIENT;
        protected ddscControlLibrary.InputBoxCtrl txtSUPPLY_COEFFICIENT;
        protected System.Web.UI.WebControls.Label lblSUPPLY_UNIT;
        protected System.Web.UI.WebControls.Label lblPRICE_CHANGE_DATE;
        protected System.Web.UI.WebControls.Label lblCURRENCY_TYPE;
        protected System.Web.UI.WebControls.Label lblEFF_DATE;
        protected ddscControlLibrary.InputBoxCtrl txtEFF_DATE;
        protected ddscControlLibrary.InputBoxCtrl txtEXP_DATE;
        protected System.Web.UI.WebControls.Label lblAGENT1;
        protected ddscControlLibrary.InputBoxCtrl txtSUPPLY_UNIT;
        protected ddscControlLibrary.InputBoxCtrl txtPRICE_CHANGE_DATE;
        protected ddscControlLibrary.InputBoxCtrl txtAGENT;
        protected System.Web.UI.WebControls.Label lblAGENT_ADDRESS1;
        protected ddscControlLibrary.InputBoxCtrl txtAGENT_ADDRESS1;
        protected System.Web.UI.WebControls.Label lblCLERK;
        protected ddscControlLibrary.InputBoxCtrl txtCLERK;
        protected System.Web.UI.WebControls.Label lblCLERK_ADDRESS;
        protected ddscControlLibrary.InputBoxCtrl txtCLERK_ADDRESS;
        protected System.Web.UI.WebControls.Label lblBAS_SUPPLY;
        protected System.Web.UI.WebControls.Label lblB2B_SUPPLY;
        protected System.Web.UI.WebControls.Label lblSUPPLY_PRICE1;
        protected ddscControlLibrary.InputBoxCtrl txtSUPPLY_PRICE1;
        protected System.Web.UI.WebControls.Label lblMINNUM_QTY1;
        protected System.Web.UI.WebControls.Label lblSUPPLY_UNIT1;
        protected ddscControlLibrary.InputBoxCtrl txtMINNUM_QTY1;
        protected System.Web.UI.WebControls.Label lblPAYMENT_TERM_NO;
        protected System.Web.UI.WebControls.DropDownList drpPAYMENT_TERM_NO;
        protected System.Web.UI.WebControls.Label lblDELIVERY_TERM;
        protected System.Web.UI.WebControls.DropDownList drpDELIVERY_TERM;
        protected System.Web.UI.WebControls.Label lblSEAPORT;
        protected ddscControlLibrary.InputBoxCtrl txtSEAPORT;
        protected System.Web.UI.WebControls.Label lblDELIVERY_TERM_ERR;
        protected System.Web.UI.WebControls.Label lblQUOTATION_VALID_DATE;
        protected ddscControlLibrary.DateCtrl txtQUOTATION_VALID_DATE;
        protected ddscControlLibrary.SubmitButtonCtrl btnDel;
        protected System.Web.UI.WebControls.DropDownList drpSUPPLY_UNIT;
        protected ddscControlLibrary.InputBoxCtrl txtMAIL_ADDRESS;
        protected System.Web.UI.WebControls.Label lblMAIL_ADDRESS;
        protected System.Web.UI.HtmlControls.HtmlTable B2B_SUPPLY_TABLE;
        protected System.Web.UI.WebControls.Label lblSUPPLY_PRICE_ERR;
        protected System.Web.UI.WebControls.Label lblMINNUM_QTY_ERR;
        protected System.Web.UI.WebControls.Label lblQUOTATION_VALID_DATE_ERR;
        protected System.Web.UI.WebControls.Label lblPAYMENT_TERM_NO_ERR;
        protected System.Web.UI.WebControls.Label lblDELIVERY_TERM_DESC;
        protected ddscControlLibrary.InputBoxCtrl txtDELIVERY_TERM;
        protected ddscControlLibrary.InputBoxCtrl txtADVISED_PRICE;
        protected ddscControlLibrary.InputBoxCtrl txtADVISED_PRICE_TAX;
        protected ddscControlLibrary.InputBoxCtrl txtAVERAGE_PRICE;
        protected ddscControlLibrary.InputBoxCtrl txtDUTY_FREE_PRICE;
        protected ddscControlLibrary.InputBoxCtrl txtADVISED_PRICE1;
        protected ddscControlLibrary.InputBoxCtrl txtADVISED_PRICE_TAX1;
        protected ddscControlLibrary.InputBoxCtrl txtAVERAGE_PRICE1;
        protected ddscControlLibrary.InputBoxCtrl txtDUTY_FREE_PRICE1;
        protected System.Web.UI.WebControls.DropDownList drpAVERAGE_CURRENCY_TYPE;
        protected System.Web.UI.WebControls.DropDownList drpADVISED_CURRENCY_TYPE;
        protected System.Web.UI.WebControls.DropDownList drpCURRENCY_TYPE;
        protected System.Web.UI.WebControls.DropDownList drpDUTY_FREE_CURRENCY_TYPE;

        //?`?N: ?U?C?w?d?m??i?O Web Form ?]?p?u???n??????C
        //???R???β?????C
        private System.Object designerPlaceholderDeclaration;

        private void Page_Init(System.Object sender, System.EventArgs e)
        {
            //CODEGEN: ???? Web Form ?]?p?u??????k?I?s
            //????ε{???X?s???i???C
            InitializeComponent();
        }

        #endregion

        private DataTable createErrorTable(string mError)
        {

            dbReturnInfo dbInfo = new dbReturnInfo("info");
            dbInfo.AddNewRow();
            dbInfo.setReturnDataValue("F", System.Convert.ToString(999), 0, mError);
            return dbInfo.getReturnDataTable();
        }

        private bool getDELIVERY_TERM()
        {
            bool result = false;
            int i;
            try
            {
                string[] DELIVERY_TERM_EN = new string[8];
                DELIVERY_TERM_EN[0] = "FOB_Seaport";
                DELIVERY_TERM_EN[1] = "CIF_keeling";
                DELIVERY_TERM_EN[2] = "Ex_Work";
                DELIVERY_TERM_EN[3] = "CIF_?a???O?|??w";
                DELIVERY_TERM_EN[4] = "?a???O?|?j???w";
                DELIVERY_TERM_EN[5] = "?a???n?r?B?j褼??w";
                DELIVERY_TERM_EN[6] = "FOB_Airport";
                DELIVERY_TERM_EN[7] = "CIF_CKS_Airport";
                string[] DELIVERY_TERM_TW = new string[8];
                DELIVERY_TERM_TW[0] = "FOB_Seaport";
                DELIVERY_TERM_TW[1] = "CIF_keeling";
                DELIVERY_TERM_TW[2] = "Ex_Work";
                DELIVERY_TERM_TW[3] = "CIF_?a???O?|??w";
                DELIVERY_TERM_TW[4] = "?a???O?|?j???w";
                DELIVERY_TERM_TW[5] = "?a???n?r?B?j褼??w";
                DELIVERY_TERM_TW[6] = "FOB_Airport";
                DELIVERY_TERM_TW[7] = "CIF_CKS_Airport";
                // ?N???g?J?U????

                //If Session("langauage") = "zh-tw" Then
                //    drpDELIVERY_TERM.Items.Insert(0, New ListItem("Select", ""))
                //    For i = 0 To 7
                //        drpDELIVERY_TERM.Items.Insert(i + 1, New ListItem(DELIVERY_TERM_TW(i), DELIVERY_TERM_TW(i)))
                //    Next
                //Else
                //    drpDELIVERY_TERM.Items.Insert(0, New ListItem("Select", ""))
                //    For i = 0 To 7
                //        drpDELIVERY_TERM.Items.Insert(i + 1, New ListItem(DELIVERY_TERM_EN(i), DELIVERY_TERM_EN(i)))
                //    Next
                //End If


            }
            catch (Exception ex)
            {
                showException(ex.Message);
            }
            finally
            {
            }
            return result;
        }

        private bool getPAYMENT_TERM(string VENDOR_TYPE)
        {
            bool result = false;
            int i;
            try
            {
                // N汸??g?J?U????
                DataSet ds = PAYMENT_TERM_NO(VENDOR_TYPE);
                if (!(ds == null) && ds.Tables.Count > 0)
                {
                    if (!(ds == null) && ds.Tables[0].Rows[0]["ReturnCode"] != "100" && ds.Tables[0].Rows[0]["ReturnCode"] != "999")
                    {
                        drpPAYMENT_TERM_NO.DataSource = ds.Tables["BAS_PAYMENT_TERM"];
                        drpPAYMENT_TERM_NO.DataTextField = "DESCRIPTION";
                        drpPAYMENT_TERM_NO.DataValueField = "PAYMENT_TERM_NO";
                        drpPAYMENT_TERM_NO.DataBind();
                    }
                    else
                    {
                        drpPAYMENT_TERM_NO.Items.Insert(0, new ListItem("", ""));

                    }
                    drpPAYMENT_TERM_NO.Items.Insert(0, new ListItem("Select", ""));
                }
            }
            catch (Exception ex)
            {
                showException(ex.Message);
            }
            finally
            {
            }
            return result;
        }

        public DataSet PAYMENT_TERM_NO(string VENDOR_TYPE)
        {
            DataSet dsReturn = default(DataSet);

            try
            {
                // d欸???`????? sql command
                StringBuilder sb = new StringBuilder();
                //sb.Append("Select PAYMENT_TERM_NO,(PAYMENT_TERM_NO||\'-\'||DESCRIPTION) DESCRIPTION From BAS_PAYMENT_TERM  where country_kind in(\'A\',\'" + VENDOR_TYPE + "\') order by PAYMENT_TERM_NO  ");
                sb.Append("Select PAYMENT_TERM_NO,(PAYMENT_TERM_NO||\'-\'||DESCRIPTION) DESCRIPTION From BAS_PAYMENT_TERM  where country_kind in(\'A\',:VENDORTYPE) order by PAYMENT_TERM_NO  ");
                dbAccess dba = new dbAccess();
                ArrayList m_arrParam = new ArrayList();
                // DataTable Name
                string dtName = "BAS_PAYMENT_TERM";
                // Sql command
                string sqlCommands = sb.ToString();
                // create database access object
                m_arrParam.Add(dba.GetOracleParam(":VENDORTYPE", VENDOR_TYPE));
                //dsReturn = dba.runExecuteQuery(dtName, sqlCommands);
                dsReturn = dba.runExecuteQuery(dtName, sqlCommands, m_arrParam);

            }
            catch (Exception ex)
            {
                // create return object (DataSet)
                dsReturn = new DataSet("BAS_PAYMENT_TERM");
                dsReturn.Tables.Add(createErrorTable(ex.Message));
            }

            return dsReturn;
        }

        public DataSet Query_B2B_SUPPLY(string code, string Vendor_no)
        {
            DataSet dsReturn = default(DataSet);

            try
            {
                // ?d????`????? sql command
                StringBuilder sb = new StringBuilder();
                sb.Append("Select * From B2B_SUPPLY ");
                //sb.Append("Where CODE = \'" + code + "\' And Vendor_no=\'" + Vendor_no + "\' ");
                sb.Append("Where CODE = :CODE And Vendor_no=:VENDERNO ");

                // DataTable Name
                string dtName = "B2B_SUPPLY";
                // Sql command
                string sqlCommands = sb.ToString();
                // create database access object
                dbAccess dba = new dbAccess();
                ArrayList m_arrParam = new ArrayList();

                // create database access object
                m_arrParam.Add(dba.GetOracleParam(":CODE", code));
                m_arrParam.Add(dba.GetOracleParam(":VENDERNO", Vendor_no));

                //dsReturn = dba.runExecuteQuery(dtName, sqlCommands);
                dsReturn = dba.runExecuteQuery(dtName, sqlCommands, m_arrParam);
            }
            catch (Exception ex)
            {
                // create return object (DataSet)
                dsReturn = new DataSet("Query_Serial");
                dsReturn.Tables.Add(createErrorTable(ex.Message));

            }

            return dsReturn;
        }

        private void Page_Load(System.Object sender, System.EventArgs e)
        {
            //?b?o??m????{???X?H?l?
            this.btnSave.Click += btnSAVE_Click;
            this.btnDel.Click += btnDEL_Click;
            //this.btnExit.Click+=btnEXIT_Click;
            try
            {
                if (!Page.IsPostBack)
                {
                    VENDOR LoginUser = default(VENDOR);
                    if (Page.Request["action_type"].ToUpper() != "SMAS")
                    {
                        LoginUser = GetLoginUser();
                        getPAYMENT_TERM(LoginUser.VENDOR_TYPE);
                    }
                    else
                    {
                        getPAYMENT_TERM(Page.Request["VENDOR_TYPE"]);
                    }

                    getDELIVERY_TERM();
                    //Leo add
                    getCURRENCY_TYPE();

                    EnableView_BAS_SUPPLY_Controls();
                    if ((string)(Page.Request["action_type"].ToUpper()) == "ADD")
                    {
                        this.btnDel.Visible = false;
                        //將新增幣別設定為TWD
                        this.drpCURRENCY_TYPE.SelectedValue = "TWD";
                        this.drpADVISED_CURRENCY_TYPE.SelectedValue = "TWD";
                        this.drpAVERAGE_CURRENCY_TYPE.SelectedValue = "TWD";
                        this.drpDUTY_FREE_CURRENCY_TYPE.SelectedValue = "TWD";

                    }
                    else if (((string)(Page.Request["action_type"].ToUpper()) == "FIND") || ((string)(Page.Request["action_type"].ToUpper()) == "SMAS"))
                    {
                        this.btnDel.Visible = false;
                        txtSUPPLY_PRICE1.EnableView = true;
                        txtMINNUM_QTY1.EnableView = true;
                        drpSUPPLY_UNIT.Enabled = false;
                        drpPAYMENT_TERM_NO.Enabled = false;
                        drpDELIVERY_TERM.Enabled = false;
                        //txtDELIVERY_TERM.EnableView = true;
                        txtQUOTATION_VALID_DATE.EnableView = true;
                        this.btnSave.Visible = false;
                    }
                    else if ((string)(Page.Request["action_type"].ToUpper()) == "PRICE_CHANGES")
                    {
                        this.btnDel.Visible = false;
                    }
                    else if ((string)(Page.Request["action_type"].ToUpper()) == "DEL_CHANGES")
                    {
                        txtSUPPLY_PRICE1.EnableView = true;
                        drpSUPPLY_UNIT.Enabled = false;
                        txtMINNUM_QTY1.EnableView = true;
                        drpPAYMENT_TERM_NO.Enabled = false;
                        drpDELIVERY_TERM.Enabled = false;
                        //txtDELIVERY_TERM.EnableView = true;
                        txtQUOTATION_VALID_DATE.EnableView = true;
                        this.btnSave.Visible = false;
                    }
                    else
                    {
                    }
                    DataBase DataBase = new DataBase();
                    DataSet ds = default(DataSet);
                    string SelectCommand = "";
                    string szVENDOR_NO = "";
                    string szCODE = Page.Request["CODE3"];
                    if (szCODE == "")
                    {
                        szCODE = Page.Request["CODE"];
                    }
                    if (Page.Request["action_type"].ToUpper() != "SMAS")
                    {
                        szVENDOR_NO = LoginUser.VENDOR_NO;
                    }
                    else
                    {
                        szVENDOR_NO = Page.Request["VENDOR_NO"];
                    }

                    //中間的報價資料為現行報價資料 -- 抓取 VND_SUPPLY 與 BAS_MATERIAL
                    //SelectCommand = string.Format("SELECT A.*,B.ENGLISH_SHORTNAME,B.ENGLISH_FULLNAME,B.CHINESE_SHORTNAME,B.CHINESE_FULLNAME FROM (SELECT * FROM VND_SUPPLY WHERE CODE=\'{0}\' AND  VENDOR_NO=\'{1}\' ) A ,BAS_MATERIAL B  WHERE A.CODE=B.CODE(+)  ", szCODE, szVENDOR_NO);
                    SelectCommand = "SELECT A.*,B.ENGLISH_SHORTNAME,B.ENGLISH_FULLNAME,B.CHINESE_SHORTNAME,B.CHINESE_FULLNAME FROM (SELECT * FROM VND_SUPPLY WHERE CODE=:CODE AND  VENDOR_NO=:VENDORNO ) A ,BAS_MATERIAL B  WHERE A.CODE=B.CODE(+)  ";
                    dbAccess dba = new dbAccess();
                    ArrayList m_arrParam = new ArrayList();

                    m_arrParam.Add(dba.GetOracleParam(":CODE", szCODE));
                    m_arrParam.Add(dba.GetOracleParam(":VENDORNO", szVENDOR_NO));
                    ds = DataBase.Query_CLASS(SelectCommand, "VND_SUPPLY", m_arrParam);
                    //ds = dba.runExecuteQuery("VND_SUPPLY", SelectCommand, m_arrParam);

                    if (!(ds == null) && ds.Tables["info"].Rows[0]["ReturnCode"] != "100" && ds.Tables["info"].Rows[0]["ReturnCode"] != "999")
                    {
                        txtCODE.Text = System.Convert.ToString(ds.Tables["VND_SUPPLY"].Rows[0]["CODE"].ToString());
                        txtENGLISH_SHORTNAME.Text = System.Convert.ToString(ds.Tables["VND_SUPPLY"].Rows[0]["ENGLISH_SHORTNAME"].ToString());
                        txtCHINESE_SHORTNAME.Text = System.Convert.ToString(ds.Tables["VND_SUPPLY"].Rows[0]["CHINESE_SHORTNAME"].ToString());
                        txtCHINESE_FULLNAME.Text = System.Convert.ToString(ds.Tables["VND_SUPPLY"].Rows[0]["CHINESE_FULLNAME"].ToString());
                        txtENGLISH_FULLNAME.Text = System.Convert.ToString(ds.Tables["VND_SUPPLY"].Rows[0]["ENGLISH_FULLNAME"].ToString());
                        txtSUPPLY_PRICE.Text = System.Convert.ToString(ds.Tables["VND_SUPPLY"].Rows[0]["SUPPLY_PRICE"].ToString());
                        txtSUPPLY_COEFFICIENT.Text = System.Convert.ToString(ds.Tables["VND_SUPPLY"].Rows[0]["SUPPLY_COEFFICIENT"].ToString());
                        txtSUPPLY_UNIT.Text = System.Convert.ToString(ds.Tables["VND_SUPPLY"].Rows[0]["SUPPLY_UNIT"].ToString());
                        txtPRICE_CHANGE_DATE.Text = System.Convert.ToString(ds.Tables["VND_SUPPLY"].Rows[0]["PRICE_CHANGE_DATE"].ToString());
                        txtCURRENCY_TYPE.Text = System.Convert.ToString(ds.Tables["VND_SUPPLY"].Rows[0]["CURRENCY_TYPE"].ToString());
                        txtMINNUM_QTY.Text = System.Convert.ToString(ds.Tables["VND_SUPPLY"].Rows[0]["MINNUM_QTY"].ToString());
                        txtEFF_DATE.Text = System.Convert.ToString(ds.Tables["VND_SUPPLY"].Rows[0]["EFF_DATE"].ToString());
                        txtEXP_DATE.Text = System.Convert.ToString(ds.Tables["VND_SUPPLY"].Rows[0]["EXP_DATE"].ToString());
                        txtAGENT.Text = System.Convert.ToString(ds.Tables["VND_SUPPLY"].Rows[0]["AGENT"].ToString());
                        txtAGENT_ADDRESS1.Text = System.Convert.ToString(ds.Tables["VND_SUPPLY"].Rows[0]["AGENT_ADDRESS"].ToString());
                        txtCLERK.Text = System.Convert.ToString(ds.Tables["VND_SUPPLY"].Rows[0]["CLERK"].ToString());
                        txtCLERK_ADDRESS.Text = System.Convert.ToString(ds.Tables["VND_SUPPLY"].Rows[0]["CLERK_ADDRESS"].ToString());
                        txtMAIL_ADDRESS.Text = System.Convert.ToString(ds.Tables["VND_SUPPLY"].Rows[0]["MAIL_ADDRESS"].ToString());
                        //P3109M0050 - ADD By Joe 2009/02/20 抓取先有報價資料 建議售價 Advised_Price , 免稅售價 Duty_Free_Price , 一般商店零售價 Average_Price
                        this.txtADVISED_PRICE.Text = System.Convert.ToString(ds.Tables["VND_SUPPLY"].Rows[0]["ADVISED_PRICE"].ToString());
                        if (ds.Tables["VND_SUPPLY"].Rows[0]["ADVISED_PRICE"].ToString() != "")
                        {
                            double d = Double.Parse(ds.Tables["VND_SUPPLY"].Rows[0]["ADVISED_PRICE"].ToString());
                            this.txtADVISED_PRICE_TAX.Text = (Math.Round(d * 1.05)).ToString();
                        }
                        this.txtDUTY_FREE_PRICE.Text = System.Convert.ToString(ds.Tables["VND_SUPPLY"].Rows[0]["DUTY_FREE_PRICE"].ToString());
                        this.txtAVERAGE_PRICE.Text = System.Convert.ToString(ds.Tables["VND_SUPPLY"].Rows[0]["AVERAGE_PRICE"].ToString());

                        //  MARK BY JOE 2009/02/20
                        //' JOE ?s?W P31M080777
                        //'
                        //SelectCommand = String.Format("SELECT * FROM B2B_SUPPLY WHERE    CODE='{0}' AND VENDOR_NO='{1}' ", szCODE, szVENDOR_NO)
                        //ds = DataBase.Query_CLASS(SelectCommand, "B2B_SUPPLY")
                        //If (Not ds Is Nothing AndAlso ds.Tables("info").Rows(0)("ReturnCode") <> "100" AndAlso ds.Tables("info").Rows(0)("ReturnCode") <> "999") Then

                        //    '??~??sWT??? By Joe P3108M0777
                        //    Me.txtADVISED_PRICE.Text = ds.Tables("B2B_SUPPLY").Rows(0)("ADVISED_PRICE").ToString()
                        //    If ds.Tables("B2B_SUPPLY").Rows(0)("ADVISED_PRICE").ToString() <> "" Then
                        //        Me.txtADVISED_PRICE_TAX.Text = Math.Round(CDbl((ds.Tables("B2B_SUPPLY").Rows(0)("ADVISED_PRICE") * 1.05).ToString()))
                        //    End If
                        //    '(ds.Tables("B2B_MATERIAL").Rows(Row)("ADVISED_PRICE") * 1.05).tostring
                        //    Me.txtDUTY_FREE_PRICE.Text = ds.Tables("B2B_SUPPLY").Rows(0)("DUTY_FREE_PRICE").ToString()
                        //    Me.txtAVERAGE_PRICE.Text = ds.Tables("B2B_SUPPLY").Rows(0)("AVERAGE_PRICE").ToString()
                        //End If
                        //' ---------------------


                    }
                    else
                    {
                        showException("?藍?_! ???????A?w?Q?R??");
                    }
                    string Action = System.Convert.ToString(Page.Request["action_type"].ToUpper());
                    switch (Action)
                    {

                        case "FIND":
                        case "SMAS":
                        case "PRICE_CHANGES":
                        case "DEL_CHANGES":
                            //201111109,MODI,WALTER,P3511M0122-報價呈案程式修改案,採購編號後狀態=3,報價未完成時皆要看到,所以STATUS>=2 OR STATUS<9,都要顯示異動價格
                            //中間資料修改區 - B2B_SUPPLY
                            // P3109M0050- Add by Joe 2009/02/21 P3109M0050 增加如果是 SMAS 則 status = 8(已呈案) or 2(呈案中) 都要顯示就價格

                            //If Action <> "SMAS" Then
                            //    SelectCommand = String.Format("SELECT * FROM B2B_SUPPLY WHERE  STATUS >= '8' AND CODE='{0}' AND VENDOR_NO='{1}' ", szCODE, szVENDOR_NO)
                            //Else
                            //SelectCommand = String.Format("SELECT * FROM B2B_SUPPLY WHERE  ( STATUS >= '8' OR STATUS = '2' ) AND CODE='{0}' AND VENDOR_NO='{1}' ", szCODE, szVENDOR_NO)
                            //SelectCommand = string.Format("SELECT * FROM B2B_SUPPLY WHERE  ( STATUS >= \'2\' OR STATUS <\'9\'  ) AND CODE=\'{0}\' AND VENDOR_NO=\'{1}\' ", szCODE, szVENDOR_NO);
                            SelectCommand = "SELECT * FROM B2B_SUPPLY WHERE  ( STATUS >= \'2\' OR STATUS <\'9\'  ) AND CODE=:CODE AND VENDOR_NO=:VENDORNO";

                            m_arrParam.Clear();
                            m_arrParam.Add(dba.GetOracleParam(":CODE", szCODE));
                            m_arrParam.Add(dba.GetOracleParam(":VENDORNO", szVENDOR_NO));
                            //End If
                            ds = DataBase.Query_CLASS(SelectCommand, "B2B_SUPPLY", m_arrParam);
                            //ds = dba.runExecuteQuery("B2B_SUPPLY", SelectCommand, m_arrParam);

                            if (!(ds == null) && ds.Tables["info"].Rows[0]["ReturnCode"] != "100" && ds.Tables["info"].Rows[0]["ReturnCode"] != "999")
                            {
                                this.txtSUPPLY_PRICE1.Text = System.Convert.ToString(ds.Tables["B2B_SUPPLY"].Rows[0]["SUPPLY_PRICE"].ToString());
                                if (ds.Tables["B2B_SUPPLY"].Rows[0]["SUPPLY_UNIT"].ToString() != "")
                                {
                                    this.drpSUPPLY_UNIT.SelectedValue = System.Convert.ToString(ds.Tables["B2B_SUPPLY"].Rows[0]["SUPPLY_UNIT"].ToString());
                                }
                                else
                                {
                                    this.drpSUPPLY_UNIT.SelectedValue = "PC";
                                }
                                this.txtQUOTATION_VALID_DATE.Text = System.Convert.ToString(ds.Tables["B2B_SUPPLY"].Rows[0]["QUOTATION_VALID_DATE"].ToString());
                                this.txtMINNUM_QTY1.Text = System.Convert.ToString(ds.Tables["B2B_SUPPLY"].Rows[0]["MINNUM_QTY"].ToString());
                                this.drpPAYMENT_TERM_NO.SelectedValue = System.Convert.ToString(ds.Tables["B2B_SUPPLY"].Rows[0]["PAYMENT_TERM_NO"].ToString());

                                //??~??sWT??? By Joe P3108M0777
                                this.txtADVISED_PRICE1.Text = System.Convert.ToString(ds.Tables["B2B_SUPPLY"].Rows[0]["ADVISED_PRICE"].ToString());
                                this.txtDUTY_FREE_PRICE1.Text = System.Convert.ToString(ds.Tables["B2B_SUPPLY"].Rows[0]["DUTY_FREE_PRICE"].ToString());
                                this.txtAVERAGE_PRICE1.Text = System.Convert.ToString(ds.Tables["B2B_SUPPLY"].Rows[0]["AVERAGE_PRICE"].ToString());
                                if (ds.Tables["B2B_SUPPLY"].Rows[0]["ADVISED_PRICE"].ToString() != "")
                                {
                                    double d = Double.Parse(ds.Tables["B2B_SUPPLY"].Rows[0]["ADVISED_PRICE"].ToString());
                                    this.txtADVISED_PRICE_TAX1.Text = (Math.Round((d * 1.05)).ToString());
                                }
                                //(ds.Tables("B2B_SUPPLY").Rows(0)("ADVISED_PRICE") * 1.05).ToString()
                                string DELIVERY_TERM = ds.Tables["B2B_SUPPLY"].Rows[0]["DELIVERY_TERM"].ToString();
                                //if (DELIVERY_TERM.Length == 11)
                                //{
                                //    if (DELIVERY_TERM.Substring(0, 11) == "FOB_Seaport")
                                //    {
                                //        this.txtSEAPORT.Text = DELIVERY_TERM.Substring(11, DELIVERY_TERM.Length - 11);
                                //        DELIVERY_TERM = "FOB_Seaport";
                                //    }
                                //}
                                //txtDELIVERY_TERM.Text = DELIVERY_TERM;
                                if (DELIVERY_TERM != "CIF_長榮航空保稅倉庫" && DELIVERY_TERM != "貨送至長榮航空指定倉庫" && DELIVERY_TERM != "廠商宅配到府")
                                {
                                    DELIVERY_TERM = "CIF_長榮航空保稅倉庫";
                                }
                                drpDELIVERY_TERM.SelectedValue = DELIVERY_TERM;
                                //If Me.drpDELIVERY_TERM.Items.IndexOf(Me.drpDELIVERY_TERM.Items.FindByValue(DELIVERY_TERM)) <> -1 Then
                                //    Me.drpDELIVERY_TERM.SelectedIndex = Me.drpDELIVERY_TERM.Items.IndexOf(Me.drpDELIVERY_TERM.Items.FindByValue(DELIVERY_TERM))
                                //Else
                                //    Me.drpDELIVERY_TERM.Items.Insert(0, New ListItem(DELIVERY_TERM, "NULL"))
                                //End If


                                //leo add 幣別

                                this.drpCURRENCY_TYPE.SelectedValue = ds.Tables["B2B_SUPPLY"].Rows[0]["CURRENCY_TYPE"].ToString();
                                this.drpADVISED_CURRENCY_TYPE.SelectedValue = ds.Tables["B2B_SUPPLY"].Rows[0]["ADVISED_CURRENCY_TYPE"].ToString();
                                this.drpAVERAGE_CURRENCY_TYPE.SelectedValue = ds.Tables["B2B_SUPPLY"].Rows[0]["AVERAGE_CURRENCY_TYPE"].ToString();
                                this.drpDUTY_FREE_CURRENCY_TYPE.SelectedValue = ds.Tables["B2B_SUPPLY"].Rows[0]["DUTY_FREE_CURRENCY_TYPE"].ToString();

                                //leo add 幣別 end


                            }
                            else
                            {
                                //' Tmp mark by Joe - 2009/02/20 查詢也同時顯示 新舊報價
                                //If Action <> "PRICE_CHANGES" Then
                                //    B2B_SUPPLY_TABLE.Visible = False
                                //End If

                            }

                            break;
                    }
                }

                if (Page.Request["action_type"].ToUpper() == "FIND" || Page.Request["action_type"].ToUpper() == "SMAS")
                {

                    // P3109M0050  - Joe Add 2009/02/21
                    txtADVISED_PRICE1.EnableView = true;
                    txtAVERAGE_PRICE1.EnableView = true;
                    txtDUTY_FREE_PRICE1.EnableView = true;



                }
                else
                {
                    //P3109M0050 - Joe Add 2009/02/21
                    txtADVISED_PRICE1.EnableView = false;
                    txtAVERAGE_PRICE1.EnableView = false;
                    txtDUTY_FREE_PRICE1.EnableView = false;

                }

                //LEO ADD
                if (Page.Request["action_type"].ToUpper() == "FIND" || Page.Request["action_type"].ToUpper() == "DEL_CHANGES")
                {
                    this.drpCURRENCY_TYPE.Enabled = false;
                    this.drpADVISED_CURRENCY_TYPE.Enabled = false;
                    this.drpAVERAGE_CURRENCY_TYPE.Enabled = false;
                    this.drpDUTY_FREE_CURRENCY_TYPE.Enabled = false;

                }
                //ADD END

            }
            catch (Exception ex)
            {
                showException(ex.Message);
            }
        }

        private void btnSAVE_Click(System.Object sender, System.EventArgs e)
        {
            try
            {
                string action_type = this.Request["action_type"].ToString();
                addB2B_SUPPLY();
            }
            catch (Exception ex)
            {
                showException(ex.Message);
            }

        }

        private void btnDEL_Click(System.Object sender, System.EventArgs e)
        {
            try
            {
                delB2B_SUPPLY();
            }
            catch (Exception ex)
            {
                showException(ex.Message);
            }
        }

        private void EnableView_BAS_SUPPLY_Controls()
        {
            txtCODE.EnableView = true;
            txtENGLISH_SHORTNAME.EnableView = true;
            txtCHINESE_SHORTNAME.EnableView = true;
            txtCHINESE_FULLNAME.EnableView = true;
            txtENGLISH_FULLNAME.EnableView = true;
            txtSUPPLY_PRICE.EnableView = true;
            txtSUPPLY_COEFFICIENT.EnableView = true;
            txtSUPPLY_UNIT.EnableView = true;
            txtPRICE_CHANGE_DATE.EnableView = true;
            txtCURRENCY_TYPE.EnableView = true;
            txtMINNUM_QTY.EnableView = true;
            txtEFF_DATE.EnableView = true;
            txtEXP_DATE.EnableView = true;
            txtAGENT.EnableView = true;
            txtAGENT_ADDRESS1.EnableView = true;
            txtCLERK.EnableView = true;
            txtCLERK_ADDRESS.EnableView = true;
            txtMAIL_ADDRESS.EnableView = true;
            // P3109M0050 -Joe Add 2009/02/21
            txtADVISED_PRICE1.EnableView = true;
            txtAVERAGE_PRICE1.EnableView = true;
            txtDUTY_FREE_PRICE1.EnableView = true;

        }

        private void delB2B_SUPPLY()
        {
            // ]?w??e?? DataSet ??

            com.ddsc.common.ddscDataSet ddscDs = new com.ddsc.common.ddscDataSet();

            VENDOR LoginUser = GetLoginUser();

            // ??i?^?DataSet
            DataSet dsResult = new DataSet();
            try
            {
                //???

                com.ddsc.common.ddscDataTable ddscDt = ddscDs.createDataTable("B2B_SUPPLY");
                // ?s?WRow?ddscDt
                ddscDt.addNewRow();
                // ?]?wdscDt?U??ValueA???@?GcolumnName,???G?GcolumnValue
                ddscDt.setColumnValue("action", "string", "upd");
                ddscDt.setColumnValue("CODE", "string", txtCODE.Text.Trim());

                ddscDt.setColumnValue("status", "string", "0");
                ddscDt.setColumnValue("upd_id", "string", LoginUser.VENDOR_NO);
                ddscDt.setColumnValue("upd_date", "string", SystemDate);
                ddscDt.setColumnValue("upd_time", "string", SystemTime);
                ddscDt.setWhereValue("CODE", txtCODE.Text.Trim());


                ddscDt.addNewRow();
                ddscDt.setColumnValue("action", "string", "del");
                ddscDt.setColumnValue("CODE", "string", txtCODE.Text.Trim());
                ddscDt.setWhereValue("CODE", txtCODE.Text.Trim());
                ddscDs.addDataTable(ddscDt);

                // ??s淼Wmethod
                DataBase DataBase = new DataBase();
                dsResult = DataBase.Addition(ddscDs, "", (System.Array)null, (System.Array)null);
                // ?g?Jscript?client
                regScript(dsResult, "del");
            }
            catch (Exception ex)
            {
                showException(ex.Message);
            }
            finally
            {
            }

        }

        private void addB2B_SUPPLY()
        {
            // 設定傳送的 DataSet 物件
            com.ddsc.common.ddscDataSet ddscDs = new com.ddsc.common.ddscDataSet();

            VENDOR LoginUser = GetLoginUser();

            // 宣告回傳DataSet
            DataSet dsResult = new DataSet();
            try
            {
                //基本資料
                com.ddsc.common.ddscDataTable ddscDt = ddscDs.createDataTable("B2B_SUPPLY");
                // 新增Row至ddscDt
                ddscDt.addNewRow();
                // 設定dscDt各欄位Value，參數一：columnName,參數二：columnValue
                DataSet ds = Query_B2B_SUPPLY(txtCODE.Text.Trim(), LoginUser.VENDOR_NO);
                string action = "";
                if (!(ds == null) && ds.Tables["info"].Rows[0]["ReturnCode"] != "100" && ds.Tables["info"].Rows[0]["ReturnCode"] != "999")
                {
                    action = "upd";
                }
                else
                {
                    action = "add";
                }
                ddscDt.setColumnValue("action", "string", action);
                ddscDt.setColumnValue("CODE", "string", txtCODE.Text.Trim());
                ddscDt.setColumnValue("VENDOR_NO", "string", LoginUser.VENDOR_NO);
                ddscDt.setColumnValue("SUPPLY_UNIT", "string", this.drpSUPPLY_UNIT.SelectedValue);
                ddscDt.setColumnValue("SUPPLY_PRICE", "string", this.txtSUPPLY_PRICE1.Text.Trim());
                //舊品報價新增三欄位 By Joe P3108M0777
                ddscDt.setColumnValue("ADVISED_PRICE", "string", this.txtADVISED_PRICE1.Text.Trim());
                ddscDt.setColumnValue("DUTY_FREE_PRICE", "string", this.txtDUTY_FREE_PRICE1.Text.Trim());
                ddscDt.setColumnValue("AVERAGE_PRICE", "string", this.txtAVERAGE_PRICE1.Text.Trim());
                // --------------------
                //LEO add
                ddscDt.setColumnValue("ADVISED_CURRENCY_TYPE", "string", this.drpADVISED_CURRENCY_TYPE.SelectedValue.Trim());
                ddscDt.setColumnValue("DUTY_FREE_CURRENCY_TYPE", "string", this.drpDUTY_FREE_CURRENCY_TYPE.SelectedValue.Trim());
                ddscDt.setColumnValue("AVERAGE_CURRENCY_TYPE", "string", this.drpAVERAGE_CURRENCY_TYPE.SelectedValue.Trim());
                //LEO add end

                ddscDt.setColumnValue("QUOTATION_VALID_DATE", "string", txtQUOTATION_VALID_DATE.Text.Trim());
                //Modify By EmilyLi On 2011/07/12 - 修正資料修改區，廠商無法異動供應單價幣別問題
                //ddscDt.setColumnValue("CURRENCY_TYPE", "string", Me.txtCURRENCY_TYPE.Text.Trim())
                ddscDt.setColumnValue("CURRENCY_TYPE", "string", this.drpCURRENCY_TYPE.SelectedValue.Trim());
                ddscDt.setColumnValue("MINNUM_QTY", "string", txtMINNUM_QTY1.Text.Trim());
                ddscDt.setColumnValue("PAYMENT_TERM_NO", "string", this.drpPAYMENT_TERM_NO.SelectedValue);

                //string DELIVERY_TERM = txtDELIVERY_TERM.Text;
                string DELIVERY_TERM = drpDELIVERY_TERM.SelectedValue;

                //If drpDELIVERY_TERM.SelectedValue = "FOB_Seaport" Then
                //    DELIVERY_TERM = drpDELIVERY_TERM.SelectedValue & Me.txtSEAPORT.Text
                //Else
                //    DELIVERY_TERM = drpDELIVERY_TERM.SelectedValue
                //End If
                ddscDt.setColumnValue("DELIVERY_TERM", "string", DELIVERY_TERM);
                ddscDt.setColumnValue("status", "string", "2");
                if (action == "add")
                {
                    ddscDt.setColumnValue("crt_id", "string", LoginUser.VENDOR_NO);
                    ddscDt.setColumnValue("crt_date", "string", SystemDate);
                    ddscDt.setColumnValue("crt_time", "string", SystemTime);
                }
                else
                {
                    ddscDt.setWhereValue("CODE", txtCODE.Text.Trim());
                    ddscDt.setWhereValue("VENDOR_NO", LoginUser.VENDOR_NO);
                }
                ddscDt.setColumnValue("upd_id", "string", LoginUser.VENDOR_NO);
                ddscDt.setColumnValue("upd_date", "string", SystemDate);
                ddscDt.setColumnValue("upd_time", "string", SystemTime);
                //P3109M0050 -Joe Add 2009/02/21 增加 CP_FLAG 欄位 Default = 0 ， 有價格異動 = 1
                ddscDt.setColumnValue("CP_FLAG", "string", "1");



                ddscDs.addDataTable(ddscDt);

                // 執行新增method
                DataBase DataBase = new DataBase();
                dsResult = DataBase.Addition(ddscDs, "", (System.Array)null, (System.Array)null);
                // 寫入script至client端
                FunctionHandler FunctionHandler = new FunctionHandler();


                //發信 - 通知該類別物品所屬負責人有異動單價訊息
                regScript(dsResult, "upd");
                string MailTo = "";
                // 修改信件通知無法寄到行銷課吳淑菁問題(此為暫時方案)-請修改抓取AD MAIL
                // Dim SelectCommand As String = String.Format("select APPLICANT,b.EMAIL from  VND_RELATED_USER A,psn_open_data B WHERE VENDOR_KIND='{0}' and a.APPLICANT=b.EMPLOYEE_NO(+)", LoginUser.VENDOR_KIND)
                string SelectCommand = string.Format("select APPLICANT, DECODE(b.EMAIL,\'lindawu@evaair.com\' , \'lindascwu@evaair.com\' ,b.EMAIL  ) MAIL  from  VND_RELATED_USER A,psn_open_data B WHERE VENDOR_KIND=\'{0}\' and a.APPLICANT=b.EMPLOYEE_NO(+)", LoginUser.VENDOR_KIND);
                ds = DataBase.Query_CLASS(SelectCommand, "VND_RELATED_USER");
                int Row = 0;
                if (!(ds == null) && ds.Tables["info"].Rows[0]["ReturnCode"] != "100" && ds.Tables["info"].Rows[0]["ReturnCode"] != "999")
                {
                    for (Row = 0; Row <= ds.Tables["VND_RELATED_USER"].Rows.Count - 1; Row++)
                    {
                        //MailTo = MailTo + ds.Tables["VND_RELATED_USER"].Rows[Row]["EMAIL"].ToString() + ";";


                        //fix mail from AD by employeeid
                        string empID = ds.Tables["VND_RELATED_USER"].Rows[Row]["APPLICANT"].ToString();

                        MailTo = MailTo + (new FunctionHandler()).QueryADInfo(empID, ADQueryType.Email) + ";";
                    }
                }
                string BODY = "";
                string Subject = "";

                SelectCommand = string.Format("SELECT M.CONFIG_TYPE,D.CONFIG_CHINESE_DESC,D.CONFIG_ENGLISH_DESC,D.CONFIG_VALUE FROM BAS_REFERENCE_DATA_MASTER M,BAS_REFERENCE_DATA_DETAILS D where M.CONFIG_TYPE=D.CONFIG_TYPE(+) and M.CONFIG_TYPE=\'B2B_VNDR\' and D.CONFIG_KEY=\'SUPP_UPD\'");
                ds = DataBase.Query_CLASS(SelectCommand, "BAS_REFERENCE_DATA_MASTER");
                if (!(ds == null) && ds.Tables["info"].Rows[0]["ReturnCode"] != "100" && ds.Tables["info"].Rows[0]["ReturnCode"] != "999")
                {
                    for (Row = 0; Row <= ds.Tables["BAS_REFERENCE_DATA_MASTER"].Rows.Count - 1; Row++)
                    {
                        BODY = System.Convert.ToString(ds.Tables["BAS_REFERENCE_DATA_MASTER"].Rows[Row]["CONFIG_CHINESE_DESC"].ToString().Replace("XXXX", " " + LoginUser.VENDOR_NO + "-" + LoginUser.ENGLISH_NAME + " "));
                        //Modify By EmilyLi On 2008/08/19 - 廠商名稱多串廠商代碼
                        //Subject = ds.Tables("BAS_REFERENCE_DATA_MASTER").Rows(Row)("CONFIG_VALUE").ToString().Replace("XXXX", " " + LoginUser.ENGLISH_NAME + " ")
                        Subject = System.Convert.ToString(ds.Tables["BAS_REFERENCE_DATA_MASTER"].Rows[Row]["CONFIG_VALUE"].ToString().Replace("XXXX", " " + LoginUser.VENDOR_NO + LoginUser.ENGLISH_NAME + " "));
                    }

                }
                FunctionHandler.SentMail(Subject, MailTo, "", "", "EVAAIR Procurement Information <emilyli@evaair.com>", BODY);

            }
            catch (Exception ex)
            {
                showException(ex.Message);
            }
            finally
            {
            }
        }


        //Leo add 新增幣別選項 建議售價(未稅) 、 建議售價(含稅) 、一般商店零售價 、免稅商店售價、供應單價(未稅)
        private bool getCURRENCY_TYPE()
        {
            bool result = false;
            int i;
            try
            {
                // 將資料寫入下拉式選單
                DataSet ds = drpCURRENCY_TYPE_NO();
                if (!(ds == null) && ds.Tables.Count > 0)
                {
                    if (!(ds == null) && ds.Tables[0].Rows[0]["ReturnCode"] != "100" && ds.Tables[0].Rows[0]["ReturnCode"] != "999")
                    {
                        drpCURRENCY_TYPE.DataSource = ds.Tables["BAS_CURRENCY"];
                        drpCURRENCY_TYPE.DataTextField = "DESCRIPTION";
                        drpCURRENCY_TYPE.DataValueField = "CURRENCY_TYPE";
                        drpCURRENCY_TYPE.DataBind();
                        drpCURRENCY_TYPE.SelectedValue = "TWD";
                        drpAVERAGE_CURRENCY_TYPE.DataSource = ds.Tables["BAS_CURRENCY"];
                        drpAVERAGE_CURRENCY_TYPE.DataTextField = "DESCRIPTION";
                        drpAVERAGE_CURRENCY_TYPE.DataValueField = "CURRENCY_TYPE";
                        drpAVERAGE_CURRENCY_TYPE.DataBind();
                        drpAVERAGE_CURRENCY_TYPE.SelectedValue = "TWD";
                        drpADVISED_CURRENCY_TYPE.DataSource = ds.Tables["BAS_CURRENCY"];
                        drpADVISED_CURRENCY_TYPE.DataTextField = "DESCRIPTION";
                        drpADVISED_CURRENCY_TYPE.DataValueField = "CURRENCY_TYPE";
                        drpADVISED_CURRENCY_TYPE.DataBind();
                        drpADVISED_CURRENCY_TYPE.SelectedValue = "TWD";



                        drpDUTY_FREE_CURRENCY_TYPE.DataSource = ds.Tables["BAS_CURRENCY"];
                        drpDUTY_FREE_CURRENCY_TYPE.DataTextField = "DESCRIPTION";
                        drpDUTY_FREE_CURRENCY_TYPE.DataValueField = "CURRENCY_TYPE";
                        drpDUTY_FREE_CURRENCY_TYPE.DataBind();
                        drpDUTY_FREE_CURRENCY_TYPE.SelectedValue = "TWD";


                        drpAVERAGE_CURRENCY_TYPE.Items.Insert(0, new ListItem("", ""));
                        drpCURRENCY_TYPE.Items.Insert(0, new ListItem("", ""));
                        drpADVISED_CURRENCY_TYPE.Items.Insert(0, new ListItem("", ""));
                        drpDUTY_FREE_CURRENCY_TYPE.Items.Insert(0, new ListItem("", ""));

                    }
                    else
                    {
                        drpAVERAGE_CURRENCY_TYPE.Items.Insert(0, new ListItem("", ""));
                        drpCURRENCY_TYPE.Items.Insert(0, new ListItem("", ""));
                        drpADVISED_CURRENCY_TYPE.Items.Insert(0, new ListItem("", ""));
                        drpDUTY_FREE_CURRENCY_TYPE.Items.Insert(0, new ListItem("", ""));
                    }
                }
            }
            catch (Exception ex)
            {
                showException(ex.Message);
            }
            finally
            {
            }
            return result;
        }


        public DataSet drpCURRENCY_TYPE_NO()
        {
            DataSet dsReturn = default(DataSet);
            try
            {
                StringBuilder sb = new StringBuilder();
                sb.Append("select CURRENCY_TYPE,(CURRENCY_TYPE||\'-\'||DESCRIPTION)DESCRIPTION from BAS_CURRENCY  order by CURRENCY_TYPE  ");
                string dtName = "BAS_CURRENCY";
                string sqlCommands = sb.ToString();
                dbAccess dba = new dbAccess();
                dsReturn = dba.runExecuteQuery(dtName, sqlCommands);
            }
            catch (Exception ex)
            {
                dsReturn = new DataSet("BAS_CURRENCY");
                dsReturn.Tables.Add(createErrorTable(ex.Message));
            }
            return dsReturn;
        }

        //Leo add end
    }
}
